import 'package:cached_network_image/cached_network_image.dart';
import 'package:du_application/model/GoodsModel.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:flutter/material.dart';
class SwiperDiy extends StatelessWidget {
  final List swiperDataList;
  final double screenHeight;
  SwiperDiy({Key key, this.swiperDataList, this.screenHeight})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      height: screenHeight * 0.3,
      child: Swiper(
        itemBuilder: (BuildContext context, int index) {
          return  CachedNetworkImage( imageUrl:"${swiperDataList[index]}",

                           fit:BoxFit.fill,
                           placeholder: (context, url) =>
                               Image.asset('assets/loading.jpg',fit:BoxFit.fitWidth,),
                           // print("111");
                         );
        },
        itemCount: swiperDataList.length,
        pagination: SwiperPagination(
            builder: DotSwiperPaginationBuilder(
                color: Colors.black54,
                activeColor: Colors.white,
                size: 5,
                activeSize: 5)),
        autoplay: true,
      ),
    );
  }
}
class Swipers extends StatelessWidget {
  final Info info;
  final screenHeight;

  const Swipers({Key key,this.info, this.screenHeight}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
    child:Column(
      children: <Widget>[ 
         SwiperDiy(swiperDataList: info.gallery, screenHeight: screenHeight),
            Container(
                        color: Colors.white,
                        padding: EdgeInsets.symmetric(horizontal: 40),
                        child: Text(
                          info.name,
                          style: TextStyle(
                              fontWeight: FontWeight.w400, fontSize: 18),
                          textAlign: TextAlign.center,
                        )),
                    Container(
                        padding: EdgeInsets.only(bottom: 10),
                        color: Colors.white,
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: <Widget>[
                            Text(
                              "￥",
                              style: TextStyle(
                                  fontSize: 10, fontWeight: FontWeight.bold),
                            ),
                            Text(
                              info.retailPrice.toString(),
                              style: TextStyle(
                                  fontWeight: FontWeight.bold, fontSize: 20),
                            )
                          ],
                        )
                        )
      ],
    )
      
      
      
    
    );
  }
}